<template>
  <el-drawer
    :model-value="modelValue"
    :size="size"
    :title="title" :close-on-press-escape="false" :close-on-click-modal="false"
    :show-close="false">
    <slot></slot>
    <template #footer>
      <el-button @click="close">关闭</el-button>
      <el-button type="primary" @click="save">确定</el-button>
    </template>
  </el-drawer>
</template>

<script>
export default {
  name: 'drawer',
  setup (props, { emit }) {
    console.log(props)
    const close = () => {
      emit('close')
      emit('update:modelValue', false)
    }
    const save = () => {
      emit('save')
    }
    return {
      close,
      save
    }
  },
  props: {
    title: {
      required: false,
      type: String,
      default: '公共弹框'
    },
    modelValue: {
      required: false,
      type: Boolean,
      default: false
    },
    size: {
      required: false,
      type: String,
      default: '30%'
    }
  }
}
</script>

<style scoped>

</style>
